<template>
	<view class="box">
		<uNavbar title="概率公示" :bgColor="backgroundColor" :titleStyle="titleStyle" leftIconColor="#ffffff"  ></uNavbar>
		<view class="main">
			<view class="top">
				<view class="top1">
					奖品名称
				</view>
				<view class="top2">
					市井参考价
				</view>
				<view class="top3">
					中奖几率
				</view>
			</view>
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="top11">
					{{item.name}}*{{item.single_number}}
				</view>
				<view class="top12">
					{{item.price}}
				</view>
				<view class="top13">
					{{item.probability}}%
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {publicity}from "../../api/shopp.js"
	export default {
		data() {
			return {
				titleStyle: {
					color: '#ffffff'
				},
				backgroundColor: "transparent", //标题背景颜色
				list:[]
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			getlist(){
				publicity().then(res=>{
					this.list=res.data
					console.log(res)
				})
			},
			onPageScroll: function(e) {
				const scrollTop = e.scrollTop; // 获取页面滚动位置
				// 根据滚动位置修改状态栏样式
				if (scrollTop > 100) {
					this.backgroundColor = '#E0DDDA';
					this.titles = '详情';
				} else {
					this.backgroundColor = 'transparent';
					this.titles = '';
				}
				// console.log("滚动距离为：" + e.scrollTop);
			},
		},
	}
</script>

<style scoped lang="scss">
	.box {
		width: 100%;
		height: 2202rpx;
		background-image: url("../../static/image/boxbg.png");
		background-size: 100% 100%;
		position: relative;
	}

	.main {
		width: 704rpx;
		height: 1798rpx;
		background: #FEF2E4;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		margin: 0 auto;
		position: relative;
		// margin-top: 20rpx;
	}

	.top {
		width: 644rpx;
		height: 58rpx;
		background: linear-gradient(270deg, #FC6947 0%, #FD896F 98%);
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		margin: 0 auto;
		display: flex;
		position: relative;
		top: 20rpx;
	}

	.item {
		width: 644rpx;
		// height: 152rpx;
		height: 80rpx;
		background: #FFFFFF;
		// border-radius: 0rpx 0rpx 16rpx 16rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		position: relative;
		top: 20rpx;
	}

	.top1 {
		width: 300rpx;
		text-align: center;
		font-weight: 400;
		font-size: 26rpx;
		color: #FFFFFF;
		line-height: 58rpx;
	}

	.top2 {
		width: 200rpx;
		text-align: center;
		font-weight: 400;
		font-size:26rpx;
		color: #FFFFFF;
		line-height: 58rpx;
	}

	.top3 {

		text-align: center;
		font-weight: 400;
		font-size: 26rpx;
		color: #FFFFFF;
		line-height: 58rpx;
	}

	.top11 {
		width: 300rpx;
		text-align: center;
		font-weight: 400;
		font-size:24rpx;
		color: #3D3D3D;
		// line-height: 58rpx;
		 // white-space: nowrap;        /* 文本不换行 */
		 //            overflow: hidden;           /* 隐藏超出部分 */
		 //            text-overflow: ellipsis;    /* 显示省略号 */
	}

	.top12 {
		width: 200rpx;
		text-align: center;
		font-weight: 400;
		font-size: 28rpx;
		color: #3D3D3D;
		line-height: 58rpx;
		
	}

	.top13 {
		 white-space: nowrap;        /* 文本不换行 */
		            overflow: hidden;           /* 隐藏超出部分 */
		            text-overflow: ellipsis;    /* 显示省略号 */
		text-align: center;
		font-weight: 400;
		font-size: 28rpx;
		color: #3D3D3D;
		line-height: 58rpx;
	}
</style>